#import "NSDateFormatter+Category.h"

@implementation NSDateFormatter (Category)

/// @"yyyy-MM-dd HH:mm:ss"
+ (NSDateFormatter *)getFormatterWithTimeZoneGMT_8
{
    NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
    [formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT+0800"]];
    formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
    return formatter;
}

/// @"HH:mm"
+ (NSDateFormatter *)getHMFormatterWithTimeZoneGMT_8
{
    NSDateFormatter * hmFormatter = [[NSDateFormatter alloc] init];
    [hmFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT+0800"]];
    hmFormatter.dateFormat = @"HH:mm";
    return hmFormatter;
}

/// @"yyyy-MM-dd" 比较日期用的NSDateFormatter
+ (NSDateFormatter *)getCompareFormatter
{
    NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
    [formatter setTimeZone:[NSTimeZone localTimeZone]];
    formatter.dateFormat = @"yyyy-MM-dd";
    return formatter;
}

@end
